<link rel="stylesheet" type="text/css" media="all" href="../css/validate.css" />
<link rel="stylesheet" type="text/css" href="../css/start/jquery-ui-1.8.13.custom.css" /> 
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="../js/jquery.validate.min.js"></script>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/ajax.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$("input:button, input:submit").button();
	
    $('<div>').attr('id', 'loading').append(
            $('<img>').attr('src', '../images/ajax_loading.gif').attr('alt', 'Cargando...')
          ).css({
              position: 'fixed',
              display: 'none'
          })	

		$('#titulo').html("Contenido");
		$("#divFormItem").show("slow", function(){
			editarContenidoLVS();
        });		


    $('textarea[maxlength]').keyup(function () {
        var limit = parseInt($(this).attr('maxlength'));
        var text = $(this).val();
        var chars = text.length;
        if (chars > limit) {
            var new_text = text.substr(0, limit);
            $(this).val(new_text);
        }
    });		

	$("#itemForm").validate({
	    rules: {
		contenido: { required: true}						
	    },
	    messages: {
	    	contenido:"debe ingresar un contenido"  		    	
	    },
	    errorElement: "div",
	    wrapper: "div",
	    errorPlacement: function (error, element) {
	        offset = element.offset();
	        error.insertBefore(element);
	        error.addClass('message');
	        error.css('position', 'absolute');
	        error.css('left', offset.left + element.outerWidth());
	        error.css('top', offset.top);
	    },
	    submitHandler: function (form) {
			 var formInput = $('form[id$=itemForm]').serialize();
			 guardarContenidoLVS(formInput);			  
	    }     
	});		

});
</script>	
<body>	
<div id="divFormItem" style="display:none;">  
<form id="itemForm" style="margin-left:50px;width:50%">
<input type="hidden" name="id" id="id" value=""></input>
<fieldset class="ui-widget ui-widget-content ui-corner-all">
<legend class="ui-widget ui-widget-header ui-corner-all" id="titulo"></legend>  
<p><label for="contenido">Contenido</label><textarea name="contenido" id="contenido" rows="5" cols="50" maxlength="500"></textarea></p>
<br>
<p style="text-align:center"><input type="submit" name="submit" id="submit" value="Guardar"/></p>
</fieldset>
</form>
</div>
</body>  